package cn.ms.neural.moduler.blackwhite;

import java.util.Map;

import cn.ms.neural.moduler.IModuler;
import cn.ms.neural.moduler.blackwhite.conf.BlackWhiteConf;
import cn.ms.neural.moduler.blackwhite.entity.BlackWhiteList;
import cn.ms.neural.moduler.blackwhite.handler.IBlackWhiteHandler;

public interface IBlackWhite<REQ, RES> extends IModuler<REQ, RES> {

	/**
	 * 注入黑白名单配置与规则
	 * 
	 * @param blackWhiteConf
	 * @param blackWhiteListMap {{key,[blackRule]},{key,[whiteRule]},{key,[blackRule,whiteRule]}...}
	 */
	 void inject(BlackWhiteConf blackWhiteConf, Map<String, BlackWhiteList[]> blackWhiteListMap);
	 
	 /**
	  * 黑白名单控制
	  * 
	  * @param bwIdKeyVals {{key,value},{key,value}...}
	  * @param blackWhiteREQ
	  * @param blackWhiteHandler
	  * @return
	  * @throws Throwable
	  */
	 RES blackwhite(String[][] bwIdKeyVals, REQ blackWhiteREQ, IBlackWhiteHandler<REQ, RES> blackWhiteHandler) throws Throwable;
}
